/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package APP3.services;

import APP3.bookshop.book.ABook;
import APP3.bookshop.main.BookShop;
import APP3.bookshop.order.Order;
import javax.swing.DefaultListModel;

/**
 *
 * @author Asus
 */
public class OrderService {

    private BookShop bookShop;

    public OrderService(BookShop bookShop) {
        this.bookShop = bookShop;
    }

    public DefaultListModel populateOrderList() {
        DefaultListModel orderList = new DefaultListModel();
        for (Order order : bookShop.getOrders()) {
            orderList.addElement(order);

        }

        return orderList;

    }

    public DefaultListModel populateOrderBooksList(Order o) {
        DefaultListModel orderBookList = new DefaultListModel();
        for (ABook book : o.getaBookCopies().keySet()) {
            orderBookList.addElement(book);
        }

        return orderBookList;

    }

}
